var globalData = {
	server: "http://127.0.0.1:8080/",  /* server: "http://localhost:8080/",*/
	pre: "http://127.0.0.1:8080/crm/",
	socket: "ws://localhost:8080/",
	//把登陆的用户名存入h5的缓存
	setUserInfo: function(username, token, uid, email, mTel) {
		window.localStorage.setItem("username", username);
		window.localStorage.setItem("token", token);
		window.localStorage.setItem("uid", uid);
	window.localStorage.setItem("email", email);
		window.localStorage.setItem("mTel", mTel);
	},
	setSign: function(signstate) {
		window.localStorage.setItem("signstate", signstate);
	},
	setPer: function(plist) { //设置权限列表

		window.localStorage.setItem("plist", plist);
	},
	hasPer: function(pvalue) {
		return window.localStorage.getItem("plist").includes(pvalue);
	},
	//从H5缓存中取出当前登录的用户名
	getUserName: function() {
		return window.localStorage.getItem("username");
	},
	getToken: function() {
		return window.localStorage.getItem("token");
	},
	getPer: function() {
		return window.localStorage.getItem("plist");
	},
	getUid: function() {
		return window.localStorage.getItem("uid");
	},

	getSignid: function() {
		return window.localStorage.getItem("signstate");
	
	},
	getEmail: function() {     
		return window.localStorage.getItem("email");
	},
	getMtel: function() {     
		return window.localStorage.getItem("mTel");
		},
	//退出登录
	loginOut: function() {
		globalData.setUserInfo(null, null, null, null, null);
		window.location.href = "login.html";
	}
};
var a = globalData.getToken();
if (a == null || a == "null"||a=="") {
	var url = window.location.href;
	if (url.indexOf("login.html") >= 0) { } else {
		window.location.href = "login.html";
	}
} else {
	var url = window.location.href;
	if (url.indexOf("login.html") >= 0) {
		window.location.href = "index.html";
	}
}